This invention relates to merging images to form a panoramic image.
Image capture devices, such as cameras, are used to capture an image of a section of a view, such as a section of the front of a house. The section of the view whose image is captured by a camera is known as the field of view of the camera. Adjusting a lens associated with a camera may increase the field of view. However, there is a limit beyond which the field of view of the camera cannot be increased without compromising the quality, or xe2x80x9cresolutionxe2x80x9d, of the captured image. It is sometimes necessary to capture an image of a view that is larger than can be captured within the field of view of a camera. Multiple overlapping images of segments of the view are taken and then the images are joined together, or xe2x80x9cmerged,xe2x80x9d to form a composite image, known as a panoramic image.
An image captured by a camera distorts the sizes of objects depicted in the image so that distant objects appear smaller than closer objects. The size distortion, which is known as perspective distortion, depends on the camera position, the pointing angle of the camera, and so forth. Consequently, an object depicted in two different images might not have the same size in the two images, because of perspective distortion.
In general, one aspect of the invention relates to a method of blending images of segments of a view. The method includes determining the position of a second segment of the view represented by a second image relative to a first segment of the view represented by a first image, dividing the second image into a first section and a second section, based on the determined positions, drawing the first image on a canvas, and drawing the first section of the second image on the canvas at the determined position so that a portion of the first section masks out a portion of the first image.
In general, another aspect of the invention relates to an article that includes a computer-readable medium, which stores computer-executable instructions for blending images of segments of a view according to the method described above.
Determining the position of the segment depicted in the second image relative to the segment in the first allows the method to blend images that may represent segments of the view that are arbitrarily positioned relative to each other. It also allows the method to blend images that may have arbitrary shapes and sizes. The method also saves processing time by drawing the first image without altering it and then masking out portions of the first image with a section of the second image.
Embodiments of the invention may include one or more of the following features. The method further includes determining a position of a third segment of the view, represented by a third image, relative to the first segment, dividing the third image into a third section and a second section, based on the determined position relative to the first segment, determining a position of the third segment of the view relative to the second image, dividing the third section into a fifth and a sixth section, based on the determined position relative to the second image, and drawing the fifth section of the third image on the canvas at the determined position relative to the third image so that a portion of the fifth section obstructs at least one of the first image and the first section of the second image. Thus the method allows a new image to be added to the blended panoramic image without performing any additional processing of the earlier images. The method only computes the section of the new image that should be drawn over the panoramic image.
The method responds to a command to remove the third image by erasing the canvas; drawing the first image on the canvas; and drawing the first section of the second image on the canvas at the determined position of the second segment relative to the first segment so that portions of the first section mask out portions of the first image. The method saves processing time by simply drawing the previously determined first section on the first image, without performing any additional computations.
Prior to dividing the second image, perspective distortion in the second image is corrected to improve the quality of the panoramic image. The second image is divided into the first and second section by a dividing line that is determined based on an outline of the first image; an outline of the second image; and the relative position of the second image segment relative to the first image segment. The dividing line joins two points of intersection of the outlines of the first and second images when the second image is positioned at the determined relative position, e.g., two most distant points of intersection. The first section of the second image is determined based on how much of the second image on each side of the dividing line is overlapped by the first image. A region around the dividing line where the second image is mixed with the first image to smooth out the transition between the first image and the second image is determined. The dividing line divides the region into a first sub-region contained within the first segment of the second image and a second sub-region contained within the second segment of the second region. More of the second image is mixed in the first sub-region than the second sub-region to provide a smoother transition between the first and second images.
The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the invention will be apparent from the description and drawings, and from the claims.